<?php

namespace app\logic;

use app\forms\user\DeleteForm;
use yii\web\HttpException;
use app\forms\user\CreateForm;
use app\forms\user\StatusForm;

class UserLogic extends BaseLogic
{
    /**
     * 创建 用户
     * @param $param
     * @throws HttpException
     */
    public static function create($param)
    {
        $form = new CreateForm();
        self::_validate($form, $param);
        $form->createUser();
        throw new HttpException(200);
    }

    /**
     * 禁用、启用 用户
     * @param $param
     * @throws HttpException
     */
    public static function status($param)
    {
        $form = new StatusForm();
        self::_validate($form, $param);
        $form->setUserStatus();
        throw new HttpException(200);
    }

    /**
     * 删除 用户
     * @param $param
     * @throws HttpException
     */
    public static function delete($param)
    {
        $form = new DeleteForm();
        self::_validate($form, $param);
        $form->deleteUser();
        throw new HttpException(200);
    }
}